import React, { useEffect, useState } from 'react'
import { Button, Input } from 'antd';
import './pay.less'
import { pay } from '../../api/Student'
export default function Pay(props) {
  let { close, xcon,setok } = props
  //获取input框的值
  let [payvalue, setpayvalue] = useState('')
  return (
    <div className="pay">
      <div className="con">
        <div className="q">应缴费: <Input value={xcon.totlemoney} disabled/>元</div>
        <div className="q">实际缴费：<Input value={xcon.nowmoney} disabled/>元</div>
        <div className="q">欠:<Input value={xcon.totlemoney-xcon.nowmoney} disabled/>元</div>
        <div className="jiao">
          <span>缴费:</span>
          <Input type="number" min="0" onChange={(e) => {
            console.log(e.target.value);
            setpayvalue(e.target.value)
          }} />
        </div>

      </div>
      <div className="but">
        <Button type="primary" onClick={close}>取消</Button>
        <Button type="primary" onClick={() => {
          pay({ id: xcon.id, pay: payvalue, now: xcon.nowmoney }).then((res) => {
            console.log(res);
            setok()
              close()
          })
        }}>确定</Button>
      </div>
    </div>
  )
}
